class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        unordered_map<int, int> mp;
        for (int i = 0; i < nums.size(); i++) {
            int s = target - nums[i];
            auto iter = mp.find(s);
            if (iter != mp.end()) {
                return {mp[s], i};
            }
            mp.insert({nums[i], i});
        }
        return {-1, -1};
    }
};
